<?php
declare(strict_types=1);

// 递归加载验证配置
$basePath = app_path() . '/config/validate' . DIRECTORY_SEPARATOR;
$config = [];
$dirIterator = new RecursiveDirectoryIterator($basePath);
$iterator = new RecursiveIteratorIterator($dirIterator);

foreach ($iterator as $file) {
    if ($file->isFile() && 'php' === $file->getExtension()) {
        $relativePath = str_replace(
            [$basePath, '.php', DIRECTORY_SEPARATOR], 
            ['', '', '.'], 
            $file->getPathname()
        );
        
        // 将文件路径转换为点分格式：api.v1.user
        $key = rtrim($relativePath, '.');
        $config[$key] = include $file->getPathname();
    }
}

return $config;
